V2EX  ›  英汉词典
Enqueued related words: Two Sum, Fast And Slow Pointers

Two Pointers

Definition / 定义

Two pointers(双指针):一种常见的算法技巧,使用两个索引/指针变量在序列(如数组、字符串、链表)上移动,以更高效地完成搜索、比较、去重、分区或求解(常把时间复杂度从 (O(n^2)) 降到 (O(n)) 或 (O(n\log n)))。常见形式包括左右夹逼(left/right)和快慢指针(fast/slow)。在部分语境中也可泛指“两个指针(如 C 语言指针变量)”,但最常见用法是算法策略。

Pronunciation / 发音

/tuː ˈpɔɪn.tərz/

Examples / 例句

Use two pointers to remove duplicates from a sorted array.
用双指针从有序数组中删除重复元素。

By moving the left and right pointers inward, we can find the target pair in linear time after sorting.
将左右指针向内移动,排序后就能在线性时间内找到目标数对。

Etymology / 词源

pointer 原指“指示物/指针”,在计算机语境中引申为“指向某位置的变量”。two pointers 作为术语来自算法实践:用两个“指向位置”的变量在数据结构上协同移动,以减少重复扫描与不必要的比较,因而得名“双指针”。

Related Words / 相关词汇

Literary Works / 文学作品

  • Cracking the Coding Interview(《程序员面试金典》:常以“双指针/左右夹逼”解题思路出现)
  • Elements of Programming Interviews(《编程面试宝典》:多处使用 two pointers 作为数组/字符串题的核心技巧)
  • Competitive Programming 3(《算法竞赛入门经典(第3版)》:竞赛常用技巧中常见双指针思想)
  • LeetCode 题解与官方讨论(作为“作品/资料库”意义上的常见出处:Two Pointers 为高频标签与解法分类)
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   755 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 14ms · UTC 22:48 · PVG 06:48 · LAX 14:48 · JFK 17:48
♥ Do have faith in what you're doing.